package com.sky.service.impl;

import com.sky.service.ShopService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.StringRedisTemplate;
import org.springframework.stereotype.Service;

@Service
public class ShopServiceImpl implements ShopService {
    private static final String SHOP_STATUS = "SHOP_STATUS";
    @Autowired
    private StringRedisTemplate redisTemplate;

    @Override
    public void setShopStatus(Integer status) {
        redisTemplate.opsForValue().set(SHOP_STATUS, status.toString());
    }

    @Override
    public Integer getShopStatus() {
        String status = redisTemplate.opsForValue().get(SHOP_STATUS);
        return Integer.parseInt(status);
    }
}
